<?php

class LoginView{
	
	private $name = 'name';
	private $pass = 'pass';
	private $login = 'logga';
	private $logout = 'utlogga';
	
	public function DoLoginBox(){
			
		if($this->TriedToLogOut() === false)
		{
			$form = "<div id='login'>
			<form action='index.php' method='GET'>
			<label for='name'>Användarnamn: </label> <input type='text' name='$this->name' />
			<label for='password'>Lösenord: </label> <input type='password' name='$this->pass' />
			<label id='checklabel' for='check'>Remember Me </label> <input type='checkbox' id='check' value='remember' />
			<input type='submit' name='$this->login' class='button' value='Logga in'/> </form></div>";
			return $form;
		}
		else {
			return null;
		}
		
		
	}
	public function DoLogoutBox(){
		$buttom = "<div id='login'>
			<form action='index.php' method='POST'>
			<input type='submit' class='button' name='$this->logout' value='Logga ut'/>
			</form></div>";
			
		return $buttom;
	}
	public function GetUserName(){
		if(isset($_GET[$this->name]) && !empty($_GET[$this->name]))
		{
			$userName = "<div id='info'><p id='iside'> Användarnamn: " . $_GET[$this->name] . "</br>";
			return $userName;
		}

		
	}
	public function GetPassword()
	{
		if(isset($_GET[$this->pass]) && !empty($_GET[$this->pass]))
		{
			$password = "Lösenord: " . $_GET[$this->pass] . "</p></div>";
			return $password;
		}

	}
	public function TriedToLogin()
	{
		if(isset($_GET[$this->login]) && isset($_GET[$this->name]) && isset($_GET[$this->pass]) && !empty($_GET[$this->pass]) && !empty($_GET[$this->name]))
		{
			return true;
		}
		else
		{
			return false; 
		}
	}
	public function TriedToLogOut()
	{
		if(isset($_GET[$this->logout]))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}


?>